// import XLSX from "./xlsx";
// const XLSX = require("./node_modules/xlsx");
// console.log(require);

const getData = function (e) {
  return new Promise((resolve, reject) => {
    const file = e.target.files[0];
    const reader = new FileReader();

    reader.onload = function (e) {
      const data = new Uint8Array(e.target.result);
      const workbook = XLSX.read(data, { type: "array" });
      // 获取第一个工作表的数据
      const firstSheetName = workbook.SheetNames[0];
      const worksheet = workbook.Sheets[firstSheetName];
      const dataJson = XLSX.utils.sheet_to_json(worksheet);
      // console.log(dataJson); // 打印或处理数据
      resolve(dataJson);
    };
    reader.readAsArrayBuffer(file);
  });
};

const productList = [
  {
    date: "2024/12/06",
    shipList: [
      {
        shipNumber: "H1908A_C",
        partlist: [
          {
            partNumber: "CZ02S",
            position: {
              x: -24.132075273590168,
              y: 10,
              c: 214.85324841385224,
            },
          },
        ],
      },
      {
        shipNumber: "H1908A_D",
        partlist: [
          {
            partNumber: "CZ02S",
            position: {
              x: -151.50377652384017,
              y: 10,
              z: -275.2673878464026,
            },
          },
        ],
      },
    ],
  },
  {
    date: "2024/12/07",
    shipList: [
      {
        shipNumber: "H1908A_C",
        partlist: [
          {
            partNumber: "CZ02S",
            position: {
              x: -24.132075273590168,
              y: 10,
              c: 214.85324841385224,
            },
          },
          {
            partNumber: "HZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ01P",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ02P",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "CZ01P",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
      {
        shipNumber: "H1908A_D",
        partlist: [
          {
            partNumber: "CZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "CZ02P",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
    ],
  },
  {
    date: "2024/12/08",
    shipList: [
      {
        shipNumber: "H1908A_C",
        partlist: [
          {
            partNumber: "CZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ01P",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ02P",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "CZ01P",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
      {
        shipNumber: "H1908A_D",
        partlist: [
          {
            partNumber: "CZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "CZ02P",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
      {
        shipNumber: "H1908A_A",
        partlist: [
          {
            partNumber: "EZ02C",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
      {
        shipNumber: "H1908A_B",
        partlist: [
          {
            partNumber: "DZ21S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "EZ02C",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
    ],
  },
  {
    date: "2024/12/09",
    shipList: [
      {
        shipNumber: "H1908A_A",
        partlist: [
          {
            partNumber: "EZ02C",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "DZ21S",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
      {
        shipNumber: "H1908A_B",
        partlist: [
          {
            partNumber: "DZ21S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "EZ02C",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
      {
        shipNumber: "H1908A_C",
        partlist: [
          {
            partNumber: "CZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ01P",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ02P",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "CZ01P",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "HZ21T",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "CZ02P",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
      {
        shipNumber: "H1908A_D",
        partlist: [
          {
            partNumber: "CZ02S",
            position: { x: 0, y: 0, c: 0 },
          },
          {
            partNumber: "CZ02P",
            position: { x: 0, y: 0, c: 0 },
          },
        ],
      },
    ],
  },
  {
    date: "2024/12/10",
    shipList: [
      {
        shipNumber: "H1908A_A",
        partlist: [
          {
            partNumber: "EZ02C",
            position: {
              x: -7.456767575046987,
              y: 10,
              z: 5.2921182544439915,
            },
            rotation: {
              x: "",
              y: "",
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-131.44484327293657",
              y: "26.51870071282871",
              z: "383.5918384480623",
            },
          },
          {
            partNumber: "DZ21S",
            position: {
              x: -109.61309771824891,
              y: 10,
              z: -88.48790310578191,
            },
            rotation: {
              x: "",
              y: "",
              z: "",
            },
            startPos: {
              x: -13.8902373500339,
              y: 10,
              z: -389.57879083209684,
            },
            assemblyPos: {
              x: "-131.44484327293657",
              y: "26.51870071282871",
              z: "383.5918384480623",
            },
          },
        ],
      },
      {
        shipNumber: "H1908A_B",
        partlist: [
          {
            partNumber: "DZ21S",
            position: {
              x: -143.67428601514294,
              y: 10,
              z: -88.4259687405719,
            },
            rotation: {
              x: "",
              y: "",
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-131.44484327293657",
              y: "26.51870071282871",
              z: "132.22434256173696",
            },
          },
          {
            partNumber: "EZ02C",
            position: {
              x: -70.8516208911575,
              y: 14.911044502882056,
              z: -180.0680761734114,
            },
            rotation: {
              x: "",
              y: "",
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 14.911044502882056,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-131.44484327293657",
              y: "26.51870071282871",
              z: "132.22434256173696",
            },
          },
        ],
      },
      {
        shipNumber: "H1908A_C",
        partlist: [
          {
            partNumber: "CZ02S",
            position: {
              x: -20.03166047974176,
              y: 10,
              z: 188.66756666469522,
            },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "302.1874538587674",
            },
          },
          {
            partNumber: "HZ02S",
            position: { x: -86.78888595475121, y: 10, z: -135.0160966541426 },
            rotation: {
              x: "",
              y: "",
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "302.1874538587674",
            },
          },
          {
            partNumber: "HZ01P",
            position: { x: -19.553816717437986, y: 10, z: -27.15388718007837 },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "302.1874538587674",
            },
          },
          {
            partNumber: "HZ02P",
            position: {
              x: -66.09646500308065,
              y: 10,
              z: -275.8303562790045,
            },
            rotation: {
              x: "",
              y: "",
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "302.1874538587674",
            },
          },
          {
            partNumber: "CZ01P",
            position: { x: -19.837350396062504, y: 10, z: 149.141138305926 },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "302.1874538587674",
            },
          },
          {
            partNumber: "HZ21T",
            position: { x: -16.524580715899024, y: 10, z: -338.41339963969625 },
            rotation: {
              x: "",
              y: "",
              z: 0.5,
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "302.1874538587674",
            },
          },
          {
            partNumber: "CZ02P",
            position: {
              x: -65.94869872602195,
              y: 10,
              z: -237.13923737447945,
            },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "302.1874538587674",
            },
          },
        ],
      },
      {
        shipNumber: "H1908A_D",
        partlist: [
          {
            partNumber: "CZ02S",
            position: {
              x: -146.8031963082735,
              y: 10,
              z: -235.50623388860083,
            },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "51.97202792784431",
            },
          },
          {
            partNumber: "CZ02P",
            position: { x: -24.23135371826325, y: 10, z: 448.6887128699351 },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "51.97202792784431",
            },
          },
          {
            partNumber: "HZ01S",
            position: { x: -19.514993073753356, y: 10, z: 110.22679471594873 },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "51.97202792784431",
            },
          },
          {
            partNumber: "CZ01S",
            position: {
              x: -126.84464272238746,
              y: 10,
              z: -196.38221267009976,
            },
            rotation: {
              x: "",
              y: 0.5,
              z: "",
            },
            startPos: {
              x: -115.07547040436181,
              y: 10,
              z: -342.4146059771677,
            },
            assemblyPos: {
              x: "-81.3086656092463",
              y: "26.51870071282871",
              z: "",
            },
          },
        ],
      },
    ],
  },
];

// 总段与分段的关系
const structuralData = [
  {
    parentNumber: "CZ01P",
    childList: ["CB01P", "CB02P", "CB03P", "CW01P", "CW02P", "CW03P"],
  },
  {
    parentNumber: "CZ01S",
    childList: ["CB01S", "CB02S", "CB03S", "CW01S", "CW02S", "CW03S"],
  },
  {
    parentNumber: "CZ02P",
    childList: ["CB04P", "CB05P", "CB06P", "CW04P", "CW05P", "CW06P"],
  },
  {
    parentNumber: "CZ02S",
    childList: ["CB04S", "CB05S", "CB06S", "CW04S", "CW05S", "CW06S"],
  },
  {
    parentNumber: "HZ01P",
    childList: ["HB01P", "HB02P", "HB03P", "HW01P", "HW02P", "HW03P"],
  },
  {
    parentNumber: "HZ01S",
    childList: ["HB01S", "HB02S", "HB03S", "HW01S", "HW02S", "HW03S"],
  },
  {
    parentNumber: "HZ02P",
    childList: ["HB04P", "HB05P", "HB06P", "HW04P", "HW05P", "HW06P"],
  },
  {
    parentNumber: "HZ02S",
    childList: ["HB04S", "HB05S", "HB06S", "HW04S", "HW05S", "HW06S"],
  },
  {
    parentNumber: "CZ11T",
    childList: ["CT11P", "CT11S"],
  },
  {
    parentNumber: "CZ21T",
    childList: ["CT21P", "CT21S"],
  },
  {
    parentNumber: "CZ12T",
    childList: ["CT12P", "CT12S"],
  },
  {
    parentNumber: "CZ22T",
    childList: ["CT22P", "CT22S"],
  },
  {
    parentNumber: "HZ11T",
    childList: ["HT11P", "HT11S"],
  },
  {
    parentNumber: "HZ21T",
    childList: ["HT21P", "HT21S"],
  },
  {
    parentNumber: "HZ12T",
    childList: ["HT12P", "HT12S"],
  },
  {
    parentNumber: "HT22T",
    childList: ["HT22P", "HT22S"],
  },
  {
    parentNumber: "CZ21P",
    childList: ["CS21P", "CS22P", "CS23P"],
  },
  {
    parentNumber: "CZ21S",
    childList: ["CS21S", "CS22S", "CS23S"],
  },
  {
    parentNumber: "CZ22P",
    childList: ["CS24P", "CS25P", "CS26P"],
  },
  {
    parentNumber: "CZ22S",
    childList: ["CS24S", "CS25S", "CS26S"],
  },
  {
    parentNumber: "HZ21P",
    childList: ["HS21P", "HS22P", "HS23P"],
  },

  {
    parentNumber: "HZ21S",
    childList: ["HS21S", "HS22S", "HS23S"],
  },
  {
    parentNumber: "HZ22P",
    childList: ["HS24P", "HS25P", "HS26P"],
  },
  {
    parentNumber: "HZ22S",
    childList: ["HS24S", "HS25S", "HS26S"],
  },
  {
    parentNumber: "CZ11P",
    childList: ["CS11P", "CS12P", "CS13P", "DH15P", "DH16P"],
  },

  {
    parentNumber: "CZ11S",
    childList: ["CS11S", "CS12S", "CS13S", "DH11S", "DH12S"],
  },

  {
    parentNumber: "CZ12P",
    childList: ["CS14P", "CS15P", "CS16P"],
  },

  {
    parentNumber: "CZ12S",
    childList: ["CS14S", "CS15S", "CS16S"],
  },

  {
    parentNumber: "HZ11P",
    childList: ["HS11P", "HS12P", "HS13P"],
  },

  {
    parentNumber: "HZ11S",
    childList: ["HS11S", "HS12S", "HS13S"],
  },
  {
    parentNumber: "HZ12P",
    childList: ["HS14A", "HS15A", "HS16A"],
  },
  {
    parentNumber: "HZ12S",
    childList: ["HS14B", "HS15B", "HS16B"],
  },
  {
    parentNumber: "CZ11C",
    childList: ["CD11C", "CD12C", "CD13C"],
  },
  {
    parentNumber: "CZ12C",
    childList: ["CD14C", "CD15C", "CD16C"],
  },
  {
    parentNumber: "HZ11C",
    childList: ["HD11C", "HD12C", "HD13C"],
  },
  {
    parentNumber: "HZ12C",
    childList: ["HD14C", "HD15C"],
  },
  {
    parentNumber: "DZ21S",
    childList: ["DH21S", "DH22S"],
  },
  {
    parentNumber: "DZ22P",
    childList: ["DH25P", "DH26P"],
  },

  {
    parentNumber: "EZ01C",
    childList: ["AB02P", "AB02C", "AB02S", "EG41P", "EG41S", "EB01P", "EB01S"],
  },

  {
    parentNumber: "EZ02C",
    childList: ["EB02P", "EB02C", "EB02S", "EB03P", "EB03S"],
  },
  {
    parentNumber: "EZ11P",
    childList: ["EG11P", "EG12P"],
  },
  {
    parentNumber: "EZ11S",
    childList: ["EG11S", "EG12S"],
  },

  {
    parentNumber: "EZ21P",
    childList: ["EG21P", "EG22P", "EG31P", "EG32P"],
  },
  {
    parentNumber: "EZ21S",
    childList: ["EG21S", "EG22S", "EG31S", "EG32S"],
  },

  {
    parentNumber: "EZ12C",
    childList: ["ED12P", "ED12S", "ED22P", "ED22S"],
  },

  {
    parentNumber: "EZ13C",
    childList: ["ED13P", "ED13S"],
  },

  {
    parentNumber: "EZ42P",
    childList: ["EG42P", "EG43P"],
  },
  {
    parentNumber: "EZ42S",
    childList: ["EG42S", "EG43S"],
  },

  {
    parentNumber: "AZ01C",
    childList: ["AB01P", "AB01C", "AB01S"],
  },
  {
    parentNumber: "AZ11C",
    childList: ["AG11P", "AG12P", "AG11S", "AG12S"],
  },

  {
    parentNumber: "FZ01C",
    childList: ["FG51C", "FB01C"],
  },
  {
    parentNumber: "FZ02C",
    childList: ["FG32C", "FG33C", "FG42C", "FG52C", "FB02C", "FB03C"],
  },

  {
    parentNumber: "FZ31P",
    childList: ["FG31P", "FG41P"],
  },
  {
    parentNumber: "FZ31C",
    childList: ["FG31C", "FG41C"],
  },
  {
    parentNumber: "FZ31S",
    childList: ["FG31S", "FG41S"],
  },
  {
    parentNumber: "FZ11C",
    childList: ["FG11P", "FG11S", "FG21P", "FG21S"],
  },
  {
    parentNumber: "FZ12C",
    childList: [
      "FG12P",
      "FG12S",
      "FG13C",
      "FG22C",
      "FG23C",
      "BU01P",
      "BU01S",
      "BU02P",
      "BU02S",
      "BU03C",
    ],
  },
  {
    parentNumber: "PZ11C",
    childList: [
      "PD11P",
      "PD11S",
      "PD21P",
      "PD21S",
      "PD31P",
      "PD41P",
      "PD41S",
      "FU01C",
    ],
  },
  {
    parentNumber: "PZ12C",
    childList: ["PD12P", "PD12S", "PD22P", "PD22S"],
  },
  {
    parentNumber: "PZ22C",
    childList: [
      "PD32P",
      "PD32S",
      "PD42P",
      "PD42S",
      "PD52P",
      "PD52S",
      "PD53P",
      "PD53S",
      "PD62P",
      "PD62S",
      "PD63P",
      "PD63S",
    ],
  },
];

// 按照表格中单位物料位置
// {
//   date: "2024/12/10",
//   shipList: [
//     {
//       shipNumber: "H1908A_A",
//       partlist: [
//         {
//           partNumber: "EZ02C",
//           position: {
//             x: 6.080447730927228,
//             y: 11.480932396036227,
//             z: -23.603690549394837,
//           },
//         },
//         {
//           partNumber: "DZ21S",
//           position: { x: -127.03867009310038, y: 10, z: -75.29292208332609 },
//         },
//       ],
//     },
//     {
//       shipNumber: "H1908A_B",
//       partlist: [
//         {
//           partNumber: "DZ21S",
//           position: {
//             x: -147.30544330488254,
//             y: 10.582654323049127,
//             z: -76.19981678566558,
//           },
//         },
//         {
//           partNumber: "EZ02C",
//           position: {
//             x: -57.76933176423873,
//             y: 14.911044502882056,
//             z: -145.2472362200868,
//           },
//         },
//       ],
//     },
//     {
//       shipNumber: "H1908A_C",
//       partlist: [
//         {
//           partNumber: "CZ02S",
//           position: {
//             x: -24.132075273590168,
//             y: 10,
//             z: 45.40118825060128,
//           },
//         },
//         {
//           partNumber: "HZ02S",
//           position: { x: -86.78888595475121, y: 10, z: -108.27442232432045 },
//         },
//         {
//           partNumber: "HZ01P",
//           position: { x: -21.95691838114829, y: 10, z: -44.84605232308869 },
//         },
//         {
//           partNumber: "HZ02P",
//           position: {
//             x: -62.91889043610381,
//             y: 9.291849161872204,
//             z: -211.2919722464571,
//           },
//         },
//         {
//           partNumber: "CZ01P",
//           position: { x: -23.900680508808552, y: 10, z: 25.251461021113045 },
//         },
//         {
//           partNumber: "HZ21T",
//           position: { x: 0, y: 0, z: 0 },
//         },
//         {
//           partNumber: "CZ02P",
//           position: {
//             x: -60.64596002352113,
//             y: 9.900948672210074,
//             z: -179.69146535321008,
//           },
//         },
//       ],
//     },
//     {
//       shipNumber: "H1908A_D",
//       partlist: [
//         {
//           partNumber: "CZ02S",
//           position: {
//             x: -151.50377652384017,
//             y: 10,
//             z: -275.2673878464026,
//           },
//         },
//         {
//           partNumber: "CZ02P",
//           position: { x: -24.23135371826325, y: 10, z: 448.6887128699351 },
//         },
//         {
//           partNumber: "HZ01S",
//           position: { x: -24.12632085724072, y: 10, z: 5.658356720760654 },
//         },
//         {
//           partNumber: "CZ01S",
//           position: { x: -138.55892754047866, y: 10, z: -241.5603029821218 },
//         },
//       ],
//     },
//   ],
// },

export { getData, productList, structuralData };
